package com.lsec.springbootinit.model.common;

import io.swagger.v3.oas.annotations.media.Schema;

import java.io.Serializable;

/**
 * 排序字段 DTO
 *
 * @author Cherry
 * @date 2023/06/02
 */
@Schema(description = "排序字段 DTO")
public class SortingField implements Serializable {

    /**
     * 顺序 - 升序
     */
    @Schema(description = "顺序 - 升序", hidden = true)
    public static final String ORDER_ASC = "asc";
    /**
     * 顺序 - 降序
     */
    @Schema(description = "顺序 - 降序", hidden = true)
    public static final String ORDER_DESC = "desc";

    /**
     * 字段
     */
    @Schema(description = "字段")
    private String field;
    /**
     * 顺序
     */
    @Schema(description = "顺序")
    private String order;

    // 空构造方法，解决反序列化
    public SortingField() {
    }

    public SortingField(String field, String order) {
        this.field = field;
        this.order = order;
    }

    public String getField() {
        return field;
    }

    public SortingField setField(String field) {
        this.field = field;
        return this;
    }

    public String getOrder() {
        return order;
    }

    public SortingField setOrder(String order) {
        this.order = order;
        return this;
    }
}
